package com.todo.user.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhangwenxiang
 * @date 2024/4/7 20:37
 * @description 假期类型枚举
 */
@Getter
@AllArgsConstructor
public enum HolidayTypeEnum {

    SCHOOL_TYPE(1, "SCHOOL_TYPE", "学生时间"),
    BASE_WORK_TYPE(2, "BASE_WORK_TYPE", "基础工人时间"),
    WAS_WORK_TYPE(3, "WAS_WORK_TYPE", "寒暑假工作者类型"),
    FREE_WORK_TYPE(4, "FREE_WORK_TYPE", "自由时间"),
    ;

    private static Map<Integer, HolidayTypeEnum> typeMap = Arrays
            .stream(HolidayTypeEnum.values())
            .collect(Collectors.toMap(HolidayTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static HolidayTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
